﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Util.Domains;
using Util.Domains.Auditing;

namespace IterationLife.Domains.Sports.Models
{
    /// <summary>
    /// 体育比赛分组
    /// </summary>
    [Description("体育比赛分组")]
    public partial class SportEventGroup : AggregateRoot<SportEventGroup>, IDelete, IAudited
    {
        /// <summary>
        /// 初始化体育比赛分组
        /// </summary>
        public SportEventGroup() : this(Guid.Empty)
        {
        }

        /// <summary>
        /// 初始化体育比赛分组
        /// </summary>
        /// <param name="id">体育比赛分组标识</param>
        public SportEventGroup(Guid id) : base(id)
        {
            SportEventGroupPeople = new List<SportEventGroupPerson>();
            SportEventGroupSections = new List<SportEventGroupSection>();
        }

        /// <summary>
        /// 体育比赛编号
        /// </summary>
        public Guid? SportEventId { get; set; }
        /// <summary>
        /// 体育队伍编号
        /// </summary>
        public Guid? SportTeamId { get; set; }
        /// <summary>
        /// 合作方分组Id
        /// </summary>
        [StringLength(200, ErrorMessage = "合作方分组Id输入过长，不能超过200位")]
        public string PartnerGroupId { get; set; }
        /// <summary>
        /// 分组全场数据
        /// </summary>
        public string JsonData { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreationTime { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public Guid? CreatorId { get; set; }
        /// <summary>
        /// 最后修改时间
        /// </summary>
        public DateTime? LastModificationTime { get; set; }
        /// <summary>
        /// 最后修改人
        /// </summary>
        public Guid? LastModifierId { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        [Required(ErrorMessage = "是否删除不能为空")]
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 体育比赛分组运动员列表
        /// </summary>
        public virtual ICollection<SportEventGroupPerson> SportEventGroupPeople { get; set; }

        /// <summary>
        /// 体育比赛
        /// </summary>
        public virtual IterationLife.Domains.Sports.Models.SportEvent SportEvent { get; set; }

        /// <summary>
        /// 体育队伍
        /// </summary>
        public virtual SportTeam SportTeam { get; set; }

        /// <summary>
        /// 体育比赛分组分段列表
        /// </summary>
        public virtual ICollection<SportEventGroupSection> SportEventGroupSections { get; set; }

        /// <summary>
        /// 添加描述
        /// </summary>
        protected override void AddDescriptions()
        {
            AddDescription("体育比赛分组Id", Id);
            AddDescription("体育比赛编号", SportEventId);
            AddDescription("体育队伍编号", SportTeamId);
            AddDescription("合作方分组Id", PartnerGroupId);
            AddDescription("分组全场数据", JsonData);
            AddDescription("创建时间", CreationTime);
            AddDescription("创建人", CreatorId);
            AddDescription("最后修改时间", LastModificationTime);
            AddDescription("最后修改人", LastModifierId);
        }

        /// <summary>
        /// 添加变更列表
        /// </summary>
        protected override void AddChanges(SportEventGroup newEntity)
        {
            AddChange("Id", "体育比赛分组Id", Id, newEntity.Id);
            AddChange("SportEventId", "体育比赛编号", SportEventId, newEntity.SportEventId);
            AddChange("SportTeamId", "体育队伍编号", SportTeamId, newEntity.SportTeamId);
            AddChange("PartnerGroupId", "合作方分组Id", PartnerGroupId, newEntity.PartnerGroupId);
            AddChange("JsonData", "分组全场数据", JsonData, newEntity.JsonData);
            AddChange("CreationTime", "创建时间", CreationTime, newEntity.CreationTime);
            AddChange("CreatorId", "创建人", CreatorId, newEntity.CreatorId);
            AddChange("LastModificationTime", "最后修改时间", LastModificationTime, newEntity.LastModificationTime);
            AddChange("LastModifierId", "最后修改人", LastModifierId, newEntity.LastModifierId);
        }
    }
}